<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CaUploadFile extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {

        Schema::create('ca_upload_files', function (Blueprint $table) {
            $table->id('file_id')->comment('自增id');
            $table->string('storage',20)->comment('存储引擎,local本地存储');
            $table->integer('group_id')->comment('组名');
            $table->string('file_url',255)->comment('文件存储路径');
            $table->string('file_name',255)->comment('文件名');
            $table->integer('file_size')->comment('文件大小');
            $table->string('file_type',20)->comment('文件类型');
            $table->string('extension',20)->comment('文件后缀');
            $table->integer('is_user')->comment('是否用户上传');
            $table->tinyInteger('is_recycle')->comment('是否回收');
            $table->tinyInteger('is_delete')->comment('是否删除');
            $table->string('modules',50)->comment('模块名');
            $table->string('md5',50)->comment('md5值');
            $table->integer('create_time')->comment('创建时间');
        });

        Schema::table('ca_upload_files', function (Blueprint $table) {
            $table->unique('md5');                   //添加唯一索引
        });

    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        //Schema::drop('ca_upload_file');
    }
}
